#pragma once
#include "IGameState.h"

#include "..\Game Objects\GameObject.h"

class Player;
class Enemy;
class Boss;
class Projectile;
class WallTriggerObject;
class DestructableObject;

#include "..\Entity Manager\EntityManager.h"
#include "..\Tile Management\TileManager.h"

#include "..\..\SGD Wrappers\SGD_Handle.h"

#include <vector>



class GameTimeAttack : public IGameState
{
private:
	float i = 2;

	/**********************************************************/
	// SINGLETON (not-dynamically allocated)
	GameTimeAttack(void) = default;	// default constructor
	virtual ~GameTimeAttack(void) = default;	// destructor

	GameTimeAttack(const GameTimeAttack&) = delete;	// copy constructor
	GameTimeAttack& operator= (const GameTimeAttack&) = delete;	// assignment operator

	// Load Level
	bool LoadLevel();
	bool bWait = true;

	// Cursor for Pause Menu
	int nCursor;

	// Level transition variables
	bool bTransition;
	enum TransitionID {DEATH = 0, LOSE, WIN, START};
	int iTransitionID;
	float fFadeoutTimer;
	float fFadeoutDuration;
	bool bGameOver;

	// Pause
	bool bGamePaused;
	bool bInPauseMenu = false;

	// Save Information
	const char* cLoc;
	char cLevel;
	bool bHalfWay;
	bool bVilliger1, bVilliger2, bVilliger3;

	// Asset Image
	SGD::HTexture hSword = SGD::INVALID_HANDLE;
	SGD::HTexture hPauseBackground = SGD::INVALID_HANDLE;
	SGD::HTexture hBackground = SGD::INVALID_HANDLE;

	// Tile Location
	const char* cTileMapLocation;

	bool bVictory;
	float fVictory;

public:
	/**********************************************************/
	// Singleton Accessor:
	static GameTimeAttack* GetInstance(void);

	virtual void Enter();
	virtual void Exit();
	virtual bool Update(float dt);
	virtual void Render();

	// Level transition functions
	void PlayDeathTransition();
	void PlayLoseTransition();
	void PlayWinTransition();
	bool IsGameOver();
	void IsGameOver(bool gameover);

	void NextLevel();
	void PlayerDeath();

	int GetTransitionID();
	bool GetTransition();
	void SetTransitionID(int ID);
	void SetTransition(bool transition);
	bool IsFadeoutFinished();
	float GetFadeoutTimer();
	void SetFadeoutTimer(float time);
	void ResetFadeoutTimer();
	float GetFadeoutDuration();
	void SetFadeoutDuration(float time);
	void RenderFadeout();

	// Render Functions
	void RenderBackground();
	void RenderPauseMenu();
	void RenderTimer();
	void RenderLevelStart();
	void RenderGameOver();
	void RenderVictory();

	void LoadSaveInformation(const char* cSaveLoc, const char cSaveLevel, const bool bSaveHalfWay, const bool bSaveVilliger1,
		const bool bSaveVilliger2, const bool bSaveVilliger3);
	bool GamePause();

	void LoadObjects(const char* fileName);

	// Add powerUps to player
	void SetPlayerPowerUps(const int dam, const int hp, const float speed);

	void SetVictory(bool win);
};

